﻿using System;
using System.Web;

namespace NWebMock
{
    public interface IHttpCachePolicy
    {
        #region Properties

        /// <summary>
        /// Gets the list of Content-Encoding headers that will be used to vary the output cache.
        /// </summary>
        IHttpCacheVaryByContentEncodings VaryByContentEncodings { get; }

        /// <summary>
        /// Gets the list of all HTTP headers that will be used to vary cache output.
        /// </summary>
        IHttpCacheVaryByHeaders VaryByHeaders { get; }

        /// <summary>
        /// Gets the list of parameters received by an HTTP GET or HTTP POST that affect caching.
        /// </summary>
        IHttpCacheVaryByParams VaryByParams { get; }

        #endregion

        #region Methods

        /// <summary>
        /// Registers a validation callback for the current response.
        /// </summary>
        /// <param name="handler">The HttpCacheValidateHandler value. </param>
        /// <param name="data">The arbitrary user-supplied data that is passed back to the AddValidationCallback delegate. </param>
        void AddValidationCallback(HttpCacheValidateHandler handler, Object data);

        /// <summary>
        /// Appends the specified text to the Cache-Control HTTP header.
        /// </summary>
        /// <param name="extension">The text to append to the Cache-Control header. </param>
        void AppendCacheExtension(string extension);

        /// <summary>
        /// Makes the response is available in the client browser History cache, regardless of the HttpCacheability setting made on the server, when the allow parameter is true.
        /// </summary>
        /// <param name="allow">true to direct the client browser to store responses in the History folder; otherwise false. The default is false. </param>
        void SetAllowResponseInBrowserHistory(bool allow);

        /// <summary>
        /// Sets the Cache-Control header to one of the values of HttpCacheability.
        /// </summary>
        /// <param name="cacheability">An HttpCacheability enumeration value. </param>
        void SetCacheability(HttpCacheability cacheability);

        /// <summary>
        /// Sets the Cache-Control header to one of the values of HttpCacheability and appends an extension to the directive.
        /// </summary>
        /// <param name="cacheability">The HttpCacheability enumeration value to set the header to. </param>
        /// <param name="field">The cache control extension to add to the header. </param>
        void SetCacheability(HttpCacheability cacheability, string field);

        /// <summary>
        /// Sets the ETag HTTP header to the specified string.
        /// </summary>
        /// <param name="etag">The text to use for the ETag header. </param>
        void SetETag(string etag);

        /// <summary>
        /// Sets the ETag HTTP header based on the time stamps of the handler's file dependencies.
        /// </summary>
        void SetETagFromFileDependencies();

        /// <summary>
        /// Sets the Expires HTTP header to an absolute date and time.
        /// </summary>
        /// <param name="date">The absolute DateTime value to set the Expires header to. </param>
        void SetExpires(DateTime date);

        /// <summary>
        /// Sets the Last-Modified HTTP header to the DateTime value supplied.
        /// </summary>
        /// <param name="date">The new DateTime value for the Last-Modified header. </param>
        void SetLastModified(DateTime date);

        /// <summary>
        /// Sets the Last-Modified HTTP header based on the time stamps of the handler's file dependencies.
        /// </summary>
        void SetLastModifiedFromFileDependencies();

        /// <summary>
        /// Sets the Cache-Control: max-age HTTP header based on the specified time span.
        /// </summary>
        /// <param name="delta">The time span used to set the Cache - Control: max-age header. </param>
        void SetMaxAge(TimeSpan delta);

        /// <summary>
        /// Stops all origin-server caching for the current response.
        /// </summary>
        void SetNoServerCaching();

        /// <summary>
        /// Sets the Cache-Control: no-store HTTP header.
        /// </summary>
        void SetNoStore();

        /// <summary>
        /// Sets the Cache-Control: no-transform HTTP header.
        /// </summary>
        void SetNoTransforms();

        /// <summary>
        /// Specifies whether the response should contain the vary:* header when varying by parameters.
        /// </summary>
        /// <param name="omit">true to direct the HttpCachePolicy to not use the * value for its VaryByHeaders property; otherwise, false.</param>
        void SetOmitVaryStar(bool omit);

        /// <summary>
        /// Sets the Cache-Control: s-maxage HTTP header based on the specified time span.
        /// </summary>
        /// <param name="delta">The time span used to set the Cache-Control: s-maxage header. </param>
        void SetProxyMaxAge(TimeSpan delta);

        /// <summary>
        /// Sets the Cache-Control HTTP header to either the must-revalidate or the proxy-revalidate directives based on the supplied enumeration value.
        /// </summary>
        /// <param name="revalidation">The HttpCacheRevalidation enumeration value to set the Cache-Control header to. </param>
        void SetRevalidation(HttpCacheRevalidation revalidation);

        /// <summary>
        /// Sets cache expiration to from absolute to sliding.
        /// </summary>
        /// <param name="slide">true or false. </param>
        void SetSlidingExpiration(bool slide);

        /// <summary>
        /// Specifies whether the ASP.NET cache should ignore HTTP Cache-Control headers sent by the client that invalidate the cache.
        /// </summary>
        /// <param name="validUntilExpires">true if the cache ignores Cache-Control invalidation headers; otherwise, false. </param>
        void SetValidUntilExpires(bool validUntilExpires);

        /// <summary>
        /// Specifies a custom text string to vary cached output responses by.
        /// </summary>
        /// <param name="custom">The text string to vary cached output by. </param>
        void SetVaryByCustom(string custom);

        #endregion
    }
}
